package com.wondersgroup.fjzlpt.org.controller.rest.jgqy.qylb;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.quick.framework.util.ExcelOrWordUtils;
import com.wondersgroup.fjzlpt.org.util.ControllerCommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.quick.framework.boot.web.utils.RequestUtils;
import com.wondersgroup.fjzlpt.org.dao.inter.jgqy.qylb.QylbDAO;
import com.wondersgroup.fjzlpt.org.dao.inter.ksxx.KsxxDAO;
import com.wondersgroup.fjzlpt.org.dao.inter.yljgxx.YljgxxDAO;
import com.wondersgroup.fjzlpt.org.service.inter.jgqy.qylb.QylbService;

@RestController
@RequestMapping("/qylb")
public class QylbRestController {
	
	@Autowired
	private QylbService qylbService;

	@Autowired
	private YljgxxDAO yljgxxDAO;
	
	@Autowired
	private QylbDAO qylbDAO;
	
	@Autowired
	private KsxxDAO ksxxDAO;
	
	
	@RequestMapping("/queryPage")
	public JSONObject queryPageYljgxx(HttpServletRequest request)
	{
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		ControllerCommonUtil.pageFormat(map);
		return qylbService.queryPage(map);
	}
	
	@RequestMapping("/save")
	public JSONObject save(HttpServletRequest request)
	{
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		return qylbService.save(map);
	}
	
	@RequestMapping("/export")
	public void export(HttpServletRequest request,HttpServletResponse response)
	{
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		JSONArray jsarry = qylbService.queryList(map);
		List<String> titleField = new ArrayList<String>();
		titleField.add("YLTMC");
		titleField.add("FQYLJGMC");
		titleField.add("YLJGMC");
		titleField.add("YLTLXMC");
		titleField.add("QYSJ");
		titleField.add("QYYXQMC");
		titleField.add("QYZT");
		ExcelOrWordUtils.downLoadExcelFile(jsarry, titleField,"签约列表",request, response);
	}
	
	@RequestMapping("/queryLsDetail")
	public JSONObject queryLsDetail(HttpServletRequest request,HttpServletResponse response)
	{
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		ControllerCommonUtil.pageFormat(map);
		return qylbService.queryLsDetail(map);
	}
	
	
	
}
